

<!DOCTYPE html>
<html lang="zh-CN">

<head><meta name="generator" content="Hexo 3.9.0">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>1.3.0-alpha04 来袭，Fragment 间通信的新姿势 - 杨云召 | 博客</title>
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta name="google" content="notranslate">

  
  
  <meta name="description" content="Fragment 间通信的新姿势 —— Result ..."> 
  
  <meta name="author" content="杨云召（Flywith24）"> 

  
    <link rel="icon" href="/images/icons/favicon-16x16.png" type="image/png" sizes="16x16">
  
  
    <link rel="icon" href="/images/icons/favicon-32x32.png" type="image/png" sizes="32x32">
  
  
    <link rel="apple-touch-icon" href="/images/icons/apple-touch-icon.png" sizes="180x180">
  
  
    <meta rel="mask-icon" href="/images/icons/stun-logo.svg" color="#333333">
  
  
    <meta rel="msapplication-TileImage" content="/images/icons/favicon-144x144.png">
    <meta rel="msapplication-TileColor" content="#000000">
  

  <link rel="stylesheet" href="/css/style.css">

  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1445822_hhodbqn7tit.css">
  

  
  
  <link rel="stylesheet" href="https://cdn.bootcss.com/fancybox/3.5.7/jquery.fancybox.min.css">
  

  
  
  <link rel="stylesheet" href="https://cdn.bootcss.com/highlight.js/9.18.1/styles/xcode.min.css">
  

  <script>
    var CONFIG = window.CONFIG || {};
    var ZHAOO = window.ZHAOO || {};
    CONFIG = {
      isHome: false,
      fancybox: true,
      pjax: false,
      lazyload: {
        enable: true,
        loadingImage: '/images/theme/loading.gif',
      },
      donate: {
        enable: true,
        alipay: 'https://gitee.com/flywith24/Album/raw/master/img/20201015113301.jpg',
        wechat: 'https://gitee.com/flywith24/Album/raw/master/img/20201015112814.png'
      },
      motto: {
        api: '',
        default: '不人云亦云，只求接近真相.'
      },
      galleries: {
        enable: true
      },
      fab: {
        enable: true,
        alwaysShow: false
      },
      carrier: {
        enable: true
      },
      daovoice: {
        enable: true
      }
    }
  </script>

  

  
</head></html>
<body class="lock-screen">
  <div class="loading"></div>
  


<nav class="navbar">
  <div class="left"></div>
  <div class="center">1.3.0-alpha04 来袭，Fragment 间通信的新姿势</div>
  <div class="right">
    <i class="iconfont iconmenu j-navbar-menu"></i>
  </div>
</nav>

  <nav class="menu">
  <div class="menu-wrap">
    <div class="menu-close">
      <i class="iconfont iconbaseline-close-px"></i>
    </div>
    <ul class="menu-content">
      
      
      
      
      <li class="menu-item"><a href="/ " class="underline"> 首页</a></li>
      
      
      
      
      <li class="menu-item"><a href="/archives " class="underline"> 归档</a></li>
      
      
      
      
      <li class="menu-item"><a href="/tags " class="underline"> 标签</a></li>
      
      
      
      
      <li class="menu-item"><a href="/categories " class="underline"> 分类</a></li>
      
      
      
      
      <li class="menu-item"><a href="/about " class="underline"> 关于</a></li>
      
    </ul>
    <div class="menu-copyright"><p>Copyright© 2017 - 2020 ❤️ Flywith24</p></div>
  </div>
</nav>
  <main id="main">
  <div class="container" id="container">
    <article class="article">
  <div class="wrap">
    <section class="head">
  <img   class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20201015102553.png" src=""  draggable="false">
  <div class="head-mask">
    <h1 class="head-title">1.3.0-alpha04 来袭，Fragment 间通信的新姿势</h1>
    <div class="head-info">
      <span class="post-info-item"><i class="iconfont iconcalendar"></i>四月 30, 2020</span
        class="post-info-item">
      
      <span class="post-info-item"><i class="iconfont iconfont-size"></i>3583</span>
    </div>
  </div>
</section>
    <section class="main">
      <section class="content">
        <h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p><code>fragment 1.3.0-alpha04</code> 发布了，其中有很多变动，其中提供了 fragment 间传递数据的新方式</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430090529.png" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt="1.3.0-alpha04 更新"></p>
<!-- more-->

<h3 id="API-更改"><a href="#API-更改" class="headerlink" title="API 更改"></a>API 更改</h3><p>首先我们介绍一下 API 更改</p>
<ul>
<li><code>startActivityForResult()</code>/<code>onActivityResult()</code> 和 <code>requestPermissions()</code>/<code>onRequestPermissionsResult()</code> 弃用</li>
<li><code>prepareCall()</code> 重命名为 <code>registerForActivityResult()</code> </li>
<li><code>target fragment API</code> 被弃用</li>
</ul>
<h3 id="Activity-Result-API-上位"><a href="#Activity-Result-API-上位" class="headerlink" title="Activity Result API 上位"></a>Activity Result API 上位</h3><p>由于官方提供了 <strong>Activity Result API</strong> 来替换 <strong>onActivityResult</strong>  机制，因此 fragment 的  <code>startActivityForResult()</code>/<code>onActivityResult()</code> 和 <code>requestPermissions()</code>/<code>onRequestPermissionsResult()</code> 方法被标记弃用了</p>
<p><strong>Activity Result API</strong> 详情可参考 <a href="https://juejin.im/user/586eff908d6d81005879507d" target="_blank" rel="noopener">秉心说</a> 的 <a href="https://juejin.im/post/5e80cb1ee51d45471654fae7" target="_blank" rel="noopener">是时候丢掉 onActivityResult 了 ！</a></p>
<p>文章介绍的很详尽，这里不再赘述</p>
<h3 id="prepareCall-重命名"><a href="#prepareCall-重命名" class="headerlink" title="prepareCall 重命名"></a>prepareCall 重命名</h3><p>值得注意的地方是 <code>prepareCall()</code> 被命名为 <code>registerForActivityResult()</code> </p>
<blockquote>
<p>注意：在版本处于 Alpha 版状态时，可以添加、移除或更改 API。因此 Alpha 版本不适合在生产上使用</p>
</blockquote>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430091418.png" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt="来自我的另一篇博客"></p>
<h3 id="target-fragment-API-被弃用"><a href="#target-fragment-API-被弃用" class="headerlink" title="target fragment API 被弃用"></a>target fragment API 被弃用</h3><p>其实 <code>target fragment API</code> 早已被弃用</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430092548.png" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt="setTargetFragment 被弃用"></p>
<p><code>target fragment</code> 需要直接访问另一个 fragment 的实例，这是十分危险的，因为你不知道目标 fragment 处于什么状态。而且 <code>target fragment</code> 不支持 Navigation</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430092824.png" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt="弃用 target fragment API"></p>
<p>那么，fragment 之间传递数据更干净的方式是什么呢？</p>
<h3 id="fragment-之间传递数据的新方式"><a href="#fragment-之间传递数据的新方式" class="headerlink" title="fragment 之间传递数据的新方式"></a>fragment 之间传递数据的新方式</h3><p>前文提到，在相同的 FragmentManager 中可以使用 target fragment API 来在 fragment 间传递数据，但这种方式需要直接访问目标fragment 的实例，这很危险，因为目标 fragment 的状态是未知的</p>
<p>因此官方提供了这样的 API，它允许在一个 fragment 上设置结果，并将该结果在 fragment 的适当的生命周期中使用。</p>
<p>这种传递数据的方式适用于 DialogFragment ，Navigation 中的 fragment</p>
<p>此更改还包括 -ktx 扩展功能以确保 kotlin 用户可以将 FragmentResultListener 作为 lambda 传递</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430105343.png" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt="FragmentA 源码"></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430105411.png" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt="FragmentB 源码"></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430105045.gif" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt="demo"></p>
<h2 id="源码分析"><a href="#源码分析" class="headerlink" title="源码分析"></a>源码分析</h2><p>老规矩，我们沿着官方的 commit log 来看看官方实现该功能的思路</p>
<p>首先，添加了 FragmentResultOwner 这样的的抽象，用于处理 fragment result，其内部有两个方法</p>
<ul>
<li>setResult</li>
<li>setResultListener</li>
</ul>
<p>前者用于发送数据，后者用于接收数据</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430110206.png" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt="FragmentResultOwner"></p>
<p>而其实现类为 FragmentManager</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430110412.png" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt="FragmentManager implement FragmentResultOwner "></p>
<p>我们来看看 FragmentManager 两个方法的具体实现</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200430111003.png" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><code class="hljs java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">final</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setFragmentResultListener</span><span class="hljs-params">(@NonNull <span class="hljs-keyword">final</span> String requestKey,<br>        @NonNull <span class="hljs-keyword">final</span> LifecycleOwner lifecycleOwner,<br>        @Nullable <span class="hljs-keyword">final</span> FragmentResultListener listener)</span> </span>&#123;<br>    <span class="hljs-comment">// 设置的 listener 为空时将 requestKey 对应的 listener 移除</span><br>    <span class="hljs-keyword">if</span> (listener == <span class="hljs-keyword">null</span>) &#123;<br>        mResultListeners.remove(requestKey);<br>        <span class="hljs-keyword">return</span>;<br>    &#125;<br>    <br>    <span class="hljs-comment">// 当fragment 处于DESTROYED 状态时 直接 return ，避免了异常</span><br>    <span class="hljs-keyword">final</span> Lifecycle lifecycle = lifecycleOwner.getLifecycle();<br>    <span class="hljs-keyword">if</span> (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) &#123;<br>        <span class="hljs-keyword">return</span>;<br>    &#125;<br>    <br>    <span class="hljs-comment">// 观察生命周期，fragment started 后接收回调，destroyed 移除回调</span><br>    LifecycleEventObserver observer = <span class="hljs-keyword">new</span> LifecycleEventObserver() &#123;<br>        <span class="hljs-meta">@Override</span><br>        <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onStateChanged</span><span class="hljs-params">(@NonNull LifecycleOwner source,<br>                @NonNull Lifecycle.Event event)</span> </span>&#123;<br>            <span class="hljs-keyword">if</span> (event == Lifecycle.Event.ON_START) &#123;<br>                <span class="hljs-comment">// once we are started, check for any stored results</span><br>                Bundle storedResult = mResults.get(requestKey);<br>                <span class="hljs-keyword">if</span> (storedResult != <span class="hljs-keyword">null</span>) &#123;<br>                    <span class="hljs-comment">// if there is a result, fire the callback</span><br>                    listener.onFragmentResult(requestKey, storedResult);<br>                    <span class="hljs-comment">// and clear the result</span><br>                    setFragmentResult(requestKey, <span class="hljs-keyword">null</span>);<br>                &#125;<br>            &#125;<br>            <span class="hljs-keyword">if</span> (event == Lifecycle.Event.ON_DESTROY) &#123;<br>                lifecycle.removeObserver(<span class="hljs-keyword">this</span>);<br>                mResultListeners.remove(requestKey);<br>            &#125;<br>        &#125;<br>    &#125;;<br>    lifecycle.addObserver(observer);<br>    mResultListeners.put(requestKey, <span class="hljs-keyword">new</span> LifecycleAwareResultListener(lifecycle, listener));<br>&#125;<br></code></pre></td></tr></table></figure>

<p>以上便是这部分的源码</p>
<blockquote>
<p>这里要注意一点的是 <code>fragment result api</code> 是基于同一 <code>FragmentManager</code> 的</p>
</blockquote>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>官方一直致力于将 fragment 的 api 变得更好用</p>
<p><a href="https://medium.com/@ianhlake" target="_blank" rel="noopener">Ian Lake</a> 在 <a href="https://www.youtube.com/watch?v=RS1IACnZLy4" target="_blank" rel="noopener">Fragments: Past, Present, and Future (Android Dev Summit ‘19)</a> 中提到了 fragment 间通信的问题，未来 fragment 会整合 fragment 自身和其内部 view 的生命周期，提供同一 FragmentManager 多返回栈的支持</p>
<p>看到 <code>fragment result API</code> ，我突然有个想法，如果将其应用到 Navigation 中是否是解决 Navigation 跳转返回后状态重置的一个方法呢？</p>
<p>各位小伙伴有什么想法欢迎评论区留言</p>
<h2 id="关于我"><a href="#关于我" class="headerlink" title="关于我"></a>关于我</h2><p>我是 <a href="https://flywith24.gitee.io/">Fly_with24</a></p>
<ul>
<li><p><a href="https://juejin.im/user/57c7f6870a2b58006b1cfd6c" target="_blank" rel="noopener">掘金</a></p>
</li>
<li><p><a href="https://www.jianshu.com/u/3d5ad6043d66" target="_blank" rel="noopener">简书</a></p>
</li>
<li><p><a href="https://github.com/Flywith24" target="_blank" rel="noopener">Github</a></p>
</li>
</ul>
<center><p> 欢迎关注我的公众号</p></center>

<div align="center"><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200429102625.jpg" src="/2020/04/30/Jetpack-fragment-ResultAPI/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg=="></div>
      </section>
      <section class="extra">
        
        <ul class="copyright">
  
  <li><strong>本文作者：</strong>杨云召（Flywith24）</li>
  <li><strong>本文链接：</strong><a href="https://flywith24.gitee.io/2020/04/30/Jetpack-fragment-ResultAPI/index.html">https://flywith24.gitee.io/2020/04/30/Jetpack-fragment-ResultAPI/index.html</a></li>
  <li><strong>版权声明：</strong>本博客所有文章均采用<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh"
      rel="external nofollow" target="_blank"> BY-NC-SA </a>许可协议，转载请注明出处！</li>
  
</ul>
        
        
        <section class="donate">
  <div class="qrcode">
    <img   class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20201015113301.jpg" src="" >
  </div>
  <div class="icon">
    <a href="javascript:;" id="alipay"><i class="iconfont iconalipay"></i></a>
    <a href="javascript:;" id="wechat"><i class="iconfont iconwechat-fill"></i></a>
  </div>
</section>
        
        
  <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Fragment/">Fragment</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Jetpack/">Jetpack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/MVVM/">MVVM</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/androidx/">androidx</a></li></ul>

        
<nav class="nav">
  
    <a href="/2020/04/30/Jetpack-fragment-savestate/"><i class="iconfont iconleft"></i>setRetainInstance 被弃用，那么 fragment 是如何保存状态的？</a>
  
  
    <a href="/2020/04/29/Jetpack-fragment-setMaxLifecycle/">setMaxLifecycle 上位，setUserVisibleHint 被弃用<i class="iconfont iconright"></i></a>
  
</nav>

      </section>
      
      <section class="comments">
  
  <div class="btn" id="comments-btn">查看评论</div>
  
  
<div id="valine"></div>
<script defer src="//unpkg.com/valine/dist/Valine.min.js"></script>
<script>
  window.onload = function () {
    var loadValine = function () {
      new Valine({
        el: '#valine',
        app_id: "SHA3gzCcxFlqaPcGRnX4UgET-gzGzoHsz",
        app_key: "OYo7ITS4AzTvBUvb1yIY8oaf",
        placeholder: "期待你的留言",
        avatar: "mp",
        pageSize: "10",
        lang: "zh-CN",
      });
    }
    if ( true ) {
      $("#comments-btn").on("click", function () {
        $(this).hide();
        loadValine();
      });
    } else {
      loadValine();
    }
  };
</script>

</section>
      
    </section>
  </div>
</article>
  </div>
</main>
  <footer class="footer">
  <div class="footer-social">
    
    
    
    
    
    <a href="tencent://message/?Menu=yes&uin=1032367864 " target="_blank" onMouseOver="this.style.color= '#12B7F5'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  iconQQ "></i>
    </a>
    
    
    
    
    
    <a href="javascript:; " target="_blank" onMouseOver="this.style.color= '#8bc34a'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  iconwechat-fill "></i>
    </a>
    
    
    
    
    
    <a href="https://flywith24.gitee.io/about/ " target="_blank" onMouseOver="this.style.color= '#d32f2f'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  iconheart "></i>
    </a>
    
    
    
    
    
    <a href="https://github.com/Flywith24 " target="_blank" onMouseOver="this.style.color= '#24292E'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  icongithub-fill "></i>
    </a>
    
    
    
    
    
    <a href="mailto:youngyunzhao@163.com " target="_blank" onMouseOver="this.style.color='#FFBE5B'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  iconmail"></i>
    </a>
    
  </div>
  <div class="footer-copyright"><p>Copyright© 2017 - 2020 ❤️ Flywith24</p></div>
</footer>
  
      <div class="fab fab-plus">
    <i class="iconfont iconplus"></i>
  </div>
  
  <div class="fab fab-daovoice">
    <i class="iconfont iconcomment"></i>
  </div>
  
  <div class="fab fab-up">
    <i class="iconfont iconcaret-up"></i>
  </div>
  
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/shizuku.model.json"},"display":{"position":"left","width":150,"height":300},"mobile":{"show":"tfalse"},"log":false});</script></body>

<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>




<script src="https://cdn.bootcdn.net/ajax/libs/jquery.lazyload/1.9.1/jquery.lazyload.min.js"></script>




<script src="https://cdn.bootcss.com/fancybox/3.5.7/jquery.fancybox.min.js"></script>




<script src="/js/utils.js"></script>
<script src="/js/modules.js"></script>
<script src="/js/zui.js"></script>
<script src="/js/script.js"></script>




<script>
  (function (i, s, o, g, r, a, m) {
    i["DaoVoiceObject"] = r;
    i[r] = i[r] || function () {
      (i[r].q = i[r].q || []).push(arguments)
    }, i[r].l = 1 * new Date();
    a = s.createElement(o), m = s.getElementsByTagName(o)[0];
    a.async = 1;
    a.src = g;
    a.charset = "utf-8";
    m.parentNode.insertBefore(a, m)
  })(window, document, "script", ('https:' == document.location.protocol ? 'https:' : 'http:') +
    "//widget.daovoice.io/widget/0f81ff2f.js", "daovoice")
  daovoice('init', {
    app_id: "7785620b"
  }, {
    launcher: {
      disableLauncherIcon: true,
    },
  });
  daovoice('update');
</script>



<script>
  (function () {
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
      bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    } else {
      bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
  })();
</script>


<script>
  var _hmt = _hmt || [];
  (function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?4c204d8bc027a0455b5fc642ac334ca8";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
</script>










</html>